#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926
#define   SQUARE(x) ((x)*(x))
//double SQUARE(double x) { return x*x;}

int cnt, ans;

bool jdg(int x)
{
	int n0 = x % 10;
	x /= 10;
	n0 -= x % 10;
	x /= 10;
	n0 -= x % 10;
	x /= 10;
	n0 -= x % 10;
	
	return n0 > 0;
}
void w1()
{
	int m, n, x,y;
	scanf("%d", &n);
	bool isPreOk = false;
 	for(int i=0; i<n; i++){
		scanf("%d", &x);
		if(jdg(x)) ans++;
 	}
	printf("%d", ans);
}

int main()
{
	w1();
  return 0;
}
